<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ page isELIgnored="false"%>
<%@ include file="../common/taglibs.jsp"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>

<title>POS收单运营管理平台</title>

<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
<link href="<s:url value="/css/a.css"/>" type="text/css" rel="stylesheet" />
<link href="<s:url value="/css/index.css"/>" type="text/css" rel="stylesheet" />
<link href="<s:url value="/css/common.css"/>" type="text/css"
	rel="stylesheet" />
	
<script type="text/javascript"
	src="<c:url value="/js/jquery-1.3.2.js" />"></script>
<script type="text/javascript"
	src="<c:url value="/js/jquery-1.7.2.min.js" />"></script>
	
<script type="text/javascript" src="<c:url value="/js/common.js" />"></script>
<script language="javascript" type="text/javascript"
	src="<c:url value="/js/My97DatePicker/WdatePicker.js"/>"></script>
<script type='text/javascript' src='<s:url value="/dwr/engine.js"/>'></script>
<script type='text/javascript' src='<s:url value="/dwr/interface/AddressQuery.js"/>'></script>	
		<script type="text/javascript" src="/js/tabcontrol/TabPanel.js"></script>
<style>
　　　
　　　　　a {
	text-decoration: none
}

　　　　　a:hover {
	color: red;
	text-decoration: none
}

a:VISITED {
	color: red;
}
　　


　　　
</style>

<script type="text/javascript">
$(document).ready(function() {
	$("#editAgent").click(
			function() {
					var dd = $("input[name=multi_sel]:checked");
					if(dd.length != 1){
						alert("只能选择一个代理商进行设置！");
						return false;
					}
					var agentid = dd.val();
					if(dd.length == 0){
						alert("请选择代理商");
						return false;
					}else{
						$("#queryUserForm").attr("action","<%=basePath%>/agentQuery/agentUpdateInit.ct?code="+agentid);
						$("#queryUserForm").submit();
					}					
		});
		
		$("#revokeBtn").click(
			function() {
					var dd = $("input[name=multi_sel]:checked");
					if(dd.length != 1){
						alert("请选择一个代理商进行操作！");
						return ;
					}
					var agentid = dd.val();
					if(dd.length == 0){
						alert("请选择代理商");
						return ;
					}else{	
					    addpanel('','终端序列号撤回','${rootPath}/termAllotRecall/termAllotRecallInfoJsp.ct?posInfo.agentId='+agentid);
					}					
		});
	});
	
function addpanel(id,title,html) {
				window.parent.parent.document.getElementById("framemain").contentWindow.addtabs(id,title,html);
}
	function deleteAgent(agentId){
	
		if(!window.confirm("您确定要删除吗？")){
		  return;
		}
		
		AddressQuery.checkSerialIsBandAndAddMer(agentId, function(backMes) {
		   if(backMes=="true1"){
		    alert("该代理商已经分配了机器序列号,不能删除");
		   }else if(backMes=="true2"){
		    alert("该代理商已经新增特约商户,不能删除");
		   }else{
		     var url = "<%=basePath%>/agentQuery/deleteAgent.ct?agentId="+agentId;
			 $("#queryUserForm").attr("action",url);
			 $("#queryUserForm").submit();
		   }	  
		   
		 });

	}	 		


</script>
</head>
<body>
		<s:form id="queryUserForm" action="/agentQuery/agentSetQuery.ct" method="post"
			theme="simple">
			<table class="tb">
		    <tbody>
				<tr class="tb-line">
					<td class="tb-td" colspan="4"><div class="tb-h2">POS收单运营管理平台</div></td>
				</tr>
				<tr class="tb-line">
					<td class="tb-td" colspan="4"><div class="tb-h3">代理商信息查询</div></td>
				</tr>
               <tr class="tb-line">
	            <td width="12%" style="min-width: 150px" align="right" class="tb-td">
	                <div class="tb-h4">代理商级别：</div>
	            </td>
	            <td class="tb-td">
                	<label class="tb-select">
					<s:select cssClass="queryWidth" name="searchCondition.agentType" list="#{'01':'全国总代','02':'省级分枝机构','03':'市级代理','04':'区县代理','05':'战略合作伙'}"  headerKey="99" headerValue="--请选择--"/>	
				</label>
				</td>
				
	            <td width="12%" style="min-width: 150px" align="right" class="tb-td">
	                <div class="tb-h4">代理商账号：</div>
	            </td>
	            <td class="tb-td">
	                <label class="tb-input-normal">
	                	<s:textfield id="accountNo"
							name="searchCondition.accountNo" cssClass="queryWidth" />
					</label>
				</td>
				</tr>
				<tr class="tb-line">
	            <td width="12%" style="min-width: 150px" align="right" class="tb-td">
	                <div class="tb-h4">代理商姓名：</div>
	            </td>
	            <td class="tb-td">
	                <label class="tb-input-normal">
	                	<s:textfield id="realName"
							name="searchCondition.realName" cssClass="queryWidth" />
					</label>
				</td>
	            <td width="12%" style="min-width: 150px" align="right" class="tb-td">
	                <div class="tb-h4">手机号：</div>
	            </td>
	            <td class="tb-td">
	                <label class="tb-input-normal">
	                	<s:textfield id="mobile"
							name="searchCondition.mobile" cssClass="queryWidth" />
					</label>
				</td>
				</tr>
				<tr class="tb-line">
	            <td width="12%" style="min-width: 150px" align="right" class="tb-td">
	                <div class="tb-h4">证件号：</div>
	            </td>
	            <td class="tb-td">
	                <label class="tb-input-normal">
	                	<s:textfield id="cardNo"
							name="searchCondition.cardNo" cssClass="queryWidth" />
					</label>
				</td>
				
                <s:if test="#session.session_merchant.roleType==\"03\"||#session.session_merchant.roleType==\"15\" || #session.session_merchant.roleType==\"16\"">
				<td width="12%" style="min-width: 150px" align="right" class="tb-td">
	                <div class="tb-h4"></div>
	            </td>
	            <td class="tb-td">
	                <label class="tb-input-normal">
					  <s:hidden name="searchCondition.orgCode" value="%{#session.session_merchant.orgCode}" />
					</label>
				</td>
			    </s:if>
			    <s:else>
	            <td width="12%" style="min-width: 150px" align="right" class="tb-td">
	                <div class="tb-h4">所属机构：</div>
	            </td>
	            <td class="tb-td">
                	<label class="tb-select">
						<s:select cssClass="queryWidth" name="searchCondition.orgCode"
							id="orgCode"
							list="#request.orgList" listKey="insIdCd" listValue="insName"/>		
					</label>
				</td>
			    </s:else>
				</tr>
				
				<tr>
			        <td width="12%" style="min-width: 150px" align="right" class="tb-td">
			            <div class="tb-h4">商户类别：</div>
			        </td>
			        <td class="tb-td">
						<s:select cssClass="queryWidth" name="searchCondition.groupCd" id="groupCd"
							list="#{'':'请选择','1':'直联','0':'间联','2':'间联直营'}" />	
					</td>
				</tr>
				<tr class="tb-line">
						<td colspan="4" align="center"><span style="font-color: red"><s:actionerror /></span>
							<span style="font-color: red;"><s:actionmessage /></span > <span style="font-color: red;"><s:fielderror
									cssClass="fieldError" /></span>
							<span id="otherError"></span>
						</td>
					</tr>
				<tr class="tb-line">
		            <td class="tb-td line-submit" align="right" colspan="4">
		                <label class="tb-input-submit">
							<s:submit value="查   询"/>
						</label>
		                <label class="tb-input-submit">
							<s:reset value="取  消" />
						</label>
					<!-- 
					<s:if
					test="#request.searchRsList != null && #request.searchRsList.size>0">
					
					
					<input type="button" id="revokeBtn"  value="序列号撤回" />	
					
				
					</s:if>
					<s:else>
					
					<input type="button" disabled="disabled" id="revokeBtn"  value="序列号撤回" />
					</s:else>
					 -->
					</td>	
				</tr>
			</table>
		
			<table width="100%" cellpadding="0" cellspacing="0" border="0">
				<s:if
					test="#request.searchRsList != null && #request.searchRsList.size>0">
					<tr class="tb-line">
						<td class="tb-td paging" colspan="12" align="left">&nbsp;&nbsp;&nbsp;&nbsp; <page:pageCount
								max_pages="11" totalPage="${requestScope.totalPage}"
								currentPage="${requestScope.currentPage}"
								action="${rootPath}/agentQuery/agentSetQuery.ct?currentPage=" />

						</td>
					</tr>
				</s:if>
			</table>
			
		<div class="big-tb">
		    <table id="tableList" class="tb" style="width: 100%;">
				<thead>
		            <tr class="tb-line">
		                <th class="tb-th" colspan="14">代理商信息变更查询列表</th>
		            </tr>
					<tr class="tb-line bg-gray">
						<th class="tb-th">账号</th>
						<th class="tb-th">姓名</th>
						<th class="tb-th">性别</th>
						<th class="tb-th">手机号</th>
						
					     <s:if test="#session.session_merchant.roleType!=\"03\" && #session.session_merchant.roleType!=\"15\" && #session.session_merchant.roleType!=\"16\"">
						  <th class="tb-th">所属机构</th> 
						 </s:if>
						
						<th class="tb-th">角色类型</th>
						<th class="tb-th">所属代理商</th>
						<th class="tb-th">证件号</th>
						<s:if test=" #request.invoiceRateFlag==\"1\"  ">
							<th class="tb-th">发票扣率</th>
							<th class="tb-th">序号编码</th>
						</s:if>
						<th class="tb-th">申请日期</th>
						<th class="tb-th">修改日期</th><!-- 
						<th class="tb-th">操作</th> -->
					</tr>
				</thead>
				<tbody>
					<s:iterator value="#request.searchRsList" status="stat" id="oper">
							<tr class="tb-line">
							<td  class="tb-td" align="center" width="8%">
								<s:if test="#session.session_merchant.roleType==\"03\"||#session.session_merchant.roleType==\"02\"">
									<s:if test="(#session.session_merchant.id==#oper.superiorId )&&#oper.status ==\"正常\"">
									
									[
									<%-- <s:property value="#oper.accountNo"/> --%>
									 
									<s:a  href="queryAgent.ct?updateFlag=1&&code=%{#oper.id}"> <s:property value="#oper.accountNo"/></s:a>
									 
									]
									</s:if>
									<s:else>
										<s:property value="#oper.accountNo"/>
									</s:else>
								 
								
								</s:if>
								<s:elseif test="#session.session_merchant.roleType==\"00\"||#session.session_merchant.roleType==\"01\"||#session.session_merchant.roleType==\"10\"||#session.session_merchant.roleType==\"18\"">
									<s:if test="#oper.status ==\"正常\"">
									
										[
										<%-- <s:property value="#oper.accountNo"/> --%>
										
										<s:a  href="queryAgent.ct?updateFlag=1&&code=%{#oper.id}"> <s:property value="#oper.accountNo"/></s:a>
										
										]
									</s:if>
									<s:else>
										<s:property value="#oper.accountNo"/>
									</s:else>
								</s:elseif>
								<s:else>
									<s:property value="#oper.accountNo"/>
								</s:else>
							
														</td>
							<td  class="tb-td" align="center" width="15%">
							<s:property value="#oper.realName"/>
							</td>
					        <td  class="tb-td" align="center" width="5%"> 
					        <s:property value="#oper.sex"/>
							</td>
							<td  class="tb-td" align="center" width="5%"> 
					        <s:property value="#oper.mobile"/>
							</td>
							
							 <s:if test="#session.session_merchant.roleType!=\"03\" && #session.session_merchant.roleType!=\"15\" && #session.session_merchant.roleType!=\"16\"">
							    <td  class="tb-td" align="center" width="8%"> 
						        <s:property value="#oper.orgName"/>
								</td>
						     </s:if>
							
							<td  class="tb-td" align="center" width="10%"> 
					        <s:property value="#oper.roleName"/>
							</td>
							<td  class="tb-td" align="center" width="10%"> 
					        <s:property value="#oper.superiorName"/>
							</td>
							<td  class="tb-td" align="center" width="10%"> 
					        <s:property value="#oper.cardNo"/>
							</td>
							<s:if test=" #request.invoiceRateFlag==\"1\"  ">
								<td class="tb-td" align="center"> 
					        		<s:property value="#oper.taxRegistrationCertificate"/>
								</td>
								<td class="tb-td" align="center"> 
					        		<s:property value="#oper.organizationCode"/>
								</td>
							</s:if>
							<td  class="tb-td" align="center"> 
					        <s:property value="#oper.dtCreateFmt"/>
							</td>
							<td  class="tb-td" align="center"> 
					        <s:property value="#oper.dtLostmodFmt"/>
							</td><%-- 
							<td  class="tb-td" align="center" width="8%">
							<a href="javascript:deleteAgent('<s:property value="#oper.id"/>')">删除</a>
							</td> --%>
						</s:iterator>
				</tbody>
			</table>
			</div>
			</s:form>
	<!-- </div> -->
</body>

<s:if test="#request.mes !=null">
		<script language="javascript">
 		alert("${request.mes}");
		</script>
	</s:if>
	
</html>
